#pragma once

#include "EncodedPtr.h"

class CMulticoreTaskScheduler;

class CMulticoreTaskSchedulerPool
{
public: 
	static HRESULT LockThreadPool();
	static HRESULT UnlockThreadPool();
	static HRESULT GetTaskScheduler(CMulticoreTaskScheduler * * ppTaskScheduler);
	static void ReleaseTaskScheduler(CMulticoreTaskScheduler * pTaskScheduler);
private: 
	static CMulticoreTaskScheduler * RemoveFromFreeList();
	static void AddToFreeList(CMulticoreTaskScheduler * pTaskScheduler);
	XINT32 m_cRefs;
	XINT32 m_cFreeList;
	EncodedPtr<IPALCriticalSection> m_pCritSection; 
private: 
	EncodedPtr<CMulticoreTaskScheduler> m_pFreeList; 


};
